from django.db import models

# Create your models here.

class Cate(models.Model):
    cate = models.CharField(max_length=30,verbose_name='类名')

    class Meta:
        db_table = 'cate'
        verbose_name = '分类'
        verbose_name_plural = verbose_name


class Books(models.Model):
    book = models.CharField(max_length=30,verbose_name='书名')
    price = models.DecimalField(max_digits=7,decimal_places=2,verbose_name='价格')
    cate = models.ForeignKey(Cate,on_delete=models.CASCADE)

    class Meta:
        db_table = 'books'
        verbose_name = '图书'
        verbose_name_plural = verbose_name